import 'package:flui/flui.dart';
import 'package:flutter/cupertino.dart';
import 'package:lepig/model/SelectProductTypeModel.dart';
import 'lib/EntityFactory.dart';
import 'lib/HttpManager.dart';
import 'lib/NWApi.dart';
import 'lib/NWMethod.dart';

/**
 * 根据分类获取商品
 */
Future<List<SelectProductTypeModel>> HttpSelectProductType(BuildContext context,int type) async {

  Map<String, dynamic> data = new Map<String, dynamic>();
  data["type"] = type.toString();

  Map responseBody = await HttpManager()
      .request(NWApi.selectProductTypePath, NWMethod.GET, params:data);
  List<dynamic> list = responseBody["data"];
  List<SelectProductTypeModel> lists=new List<SelectProductTypeModel>();
  list.forEach((element) {
    lists.add(SelectProductTypeModel.fromJson(element));
  });
  return lists;
}

